Package com.mincko.minckotest.server

Source Code of com.mincko.minckotest.server.getImages

package com.mincko.minckotest.server;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.googlecode.objectify.Objectify;
import com.mincko.minckotest.PMF;
import com.mincko.minckotest.shared.Image;
import com.google.gson.Gson;

public class getImages extends HttpServlet {
  private Objectify ofy;
    public void doPost(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException {
     
      String websiteComponentIdentifier = req.getParameter("id");
      //listing the table
      Objectify ofy = PMF.getObjectify();
      com.googlecode.objectify.Query<Image> q = ofy.query(Image.class).filter("webComponentIdentifier",websiteComponentIdentifier);
      q.order("order");
      // return to client
    res.setContentType("application/json");
    res.setCharacterEncoding("utf-8");
    res.getWriter().write((new Gson().toJson(q.list())));
       
    }
    //to support get via $.getJson
    public void doGet(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException {
      doPost(req, res);
    }

}
TOP

Related Classes of com.mincko.minckotest.server.getImages

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.